<?php
session_start();
if(session_is_registered($_REQUEST["user_id"])){}
else 
die("<a href='../../index.php'>PLEASE LOGIN AGAIN... </a>");

include("../../connect.php");

$folder_id = $_REQUEST["folder_id"];
$user_id = $_GET["user_id"];

echo "<form action='add_folder.php' method='post'>";
echo "Nom: <input type='text' name='name'>";
echo "<br> <input type='submit' value='Save' name='btn'>";
echo "<input type='hidden' value='$folder_id' name='folder_id'>";
echo "<input type='hidden' value='$user_id' name='user_id'>";
echo "</form>";

if(isset($_POST["name"])){
//die('hiiiii');
$folder_id   = $_POST["folder_id"];	
$folder_name = $_POST["name"];
$user_id = $_POST["user_id"];
//echo $query = "insert into tab_folders values('','$folder_name',$folder_id,'',1,$user_id)";
$query = "insert into articles values('',$folder_id,'$folder_name','',1,1,$user_id)";
$res = mysql_query($query); 
if($res)
echo "<script> window.location='../files.php?user_id=$user_id' </script>";
}
?>